<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2008-2011 Andreas Huber Doenni. Distributed under the Microsoft Public License (Ms-PL).
See accompanying file License.txt or copy at http://mews.codeplex.com/license.
-->
<!--
This message contains several nested multipart bodies. Some of the innermost body parts contain delimiters used by the
their indirect outer multipart entities. Judging by the contents of the message, the author must have thought that those
delimiters should be interpreted as normal content of the innermost body parts rather than as actual delimiters.
However, RFC 2046 5.1.2 clearly states that this is not the case. See inline comments for more information.
-->
<Message>
    <Header>
        <UnstructuredHeaderField name="MIME-Version">1.0</UnstructuredHeaderField>
        <ParameterizedHeaderField name="Content-Type" value="multipart/mixed">
            <Parameter name="boundary">----- =_aaaaaaaaaa0</Parameter>
        </ParameterizedHeaderField>
    </Header>
    <MultipartBody subtype="mixed">
        <Preamble />
        <BodyPart>
            <Header>
                <ParameterizedHeaderField name="Content-Type" value="multipart/mixed">
                    <Parameter name="boundary">----- =_aaaaaaaaaa1</Parameter>
                </ParameterizedHeaderField>
                <UnstructuredHeaderField name="Content-ID">&lt;20592.1022586929.1@example.com&gt;</UnstructuredHeaderField>
            </Header>
            <MultipartBody subtype="mixed">
                <Preamble />
                <BodyPart>
                    <Header>
                        <ParameterizedHeaderField name="Content-Type" value="multipart/alternative">
                            <Parameter name="boundary">----- =_aaaaaaaaaa2</Parameter>
                        </ParameterizedHeaderField>
                        <UnstructuredHeaderField name="Content-ID">&lt;20592.1022586929.2@example.com&gt;</UnstructuredHeaderField>
                    </Header>
                    <MultipartBody subtype="alternative">
                        <Preamble />
                        <BodyPart>
                            <Header>
                                <ParameterizedHeaderField name="Content-Type" value="text/plain" />
                                <UnstructuredHeaderField name="Content-ID">&lt;20592.1022586929.3@example.com&gt;</UnstructuredHeaderField>
                                <UnstructuredHeaderField name="Content-Description">very tricky</UnstructuredHeaderField>
                                <ParameterizedHeaderField name="Content-Transfer-Encoding" value="7bit" />
                            </Header>
                            <TextBody subtype="plain" format="Fixed">
Unlike the test test_nested-multiples-with-internal-boundary, this
piece of text not only contains the outer boundary tags </TextBody>
                            <!--
                            Directly after this body, a "=_aaaaaaaaaa1" delimiter appears. This terminates the text body
                            above, the containing body part, the containing multipart and the outer containing body
                            part.
                            -->
                        </BodyPart>
                        <Epilogue />
                    </MultipartBody>
                </BodyPart>
                <!--
                The following body part is a result of a "=_aaaaaaaaaa0" delimiter following almost immediately after
                the "=_aaaaaaaaaa1" delimiter. Again, this terminates the current body part, which consists only of
                the word "and", interpreted as a header field. Since the header field is invalid (no colon) we see an
                empty header.
                -->
                <BodyPart>
                    <Header />
                </BodyPart>
                <Epilogue />
            </MultipartBody>
        </BodyPart>
        <BodyPart>
            <Header>
                <!--
                Since a new body part was started, the parser now expects a header field, which appears here because
                of the colon. The double CRLF after the colon terminates the header and starts a default text body. At
                this stage the parser looks for a "=_aaaaaaaaaa0" delimiter and thus interprets anything inbetween as
                text. We could do slightly better in the header, e.g. by terminating at the first appearance of a space,
                but again this wouldn't improve matters much.
                -->
                <UnstructuredHeaderField name="but puts them at the start of a line! And, to be even nastier, it&#xD;&#xA;even includes a couple of end tags, such as this one" />
            </Header>
            <TextBody subtype="plain" format="Fixed">------- =_aaaaaaaaaa1--

and this one, which is from a multipart we haven't even seen yet!

------- =_aaaaaaaaaa4--

This will, I'm sure, cause much breakage of MIME parsers. But, as 
far as I can tell, it's perfectly legal. I have not yet ever seen
a case of this in the wild, but I've seen *similar* things.


------- =_aaaaaaaaaa2
Content-Type: application/octet-stream
Content-ID: &lt;20592.1022586929.4@example.com&gt;
Content-Description: patch2
Content-Transfer-Encoding: base64

XXX

------- =_aaaaaaaaaa2--

------- =_aaaaaaaaaa1
Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa3"
Content-ID: &lt;20592.1022586929.6@example.com&gt;

------- =_aaaaaaaaaa3
Content-Type: application/octet-stream
Content-ID: &lt;20592.1022586929.7@example.com&gt;
Content-Description: patch3
Content-Transfer-Encoding: base64

XXX

------- =_aaaaaaaaaa3
Content-Type: application/octet-stream
Content-ID: &lt;20592.1022586929.8@example.com&gt;
Content-Description: patch4
Content-Transfer-Encoding: base64

XXX

------- =_aaaaaaaaaa3--

------- =_aaaaaaaaaa1
Content-Type: multipart/alternative; boundary="----- =_aaaaaaaaaa4"
Content-ID: &lt;20592.1022586929.10@example.com&gt;

------- =_aaaaaaaaaa4
Content-Type: application/octet-stream
Content-ID: &lt;20592.1022586929.11@example.com&gt;
Content-Description: patch5
Content-Transfer-Encoding: base64

XXX

------- =_aaaaaaaaaa4
Content-Type: application/octet-stream
Content-ID: &lt;20592.1022586929.12@example.com&gt;
Content-Description: patch6
Content-Transfer-Encoding: base64

XXX

------- =_aaaaaaaaaa4--

------- =_aaaaaaaaaa1--
</TextBody>
        </BodyPart>
        <BodyPart>
            <Header>
                <ParameterizedHeaderField name="Content-Type" value="text/plain">
                    <Parameter name="charset">us-ascii</Parameter>
                </ParameterizedHeaderField>
                <UnstructuredHeaderField name="Content-ID">&lt;20592.1022586929.15@example.com&gt;</UnstructuredHeaderField>
            </Header>
            <TextBody subtype="plain" format="Fixed">--
It's never too late to have a happy childhood.
</TextBody>
        </BodyPart>
        <Epilogue />
    </MultipartBody>
</Message>